<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>发布新计划</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="layuiadmin/style/admin.css" media="all">
    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <style type="text/css">
        .sousuo {
            margin-left: 900px
        }
    </style>
    <script type="text/html" id="xuhao">
        {{d.LAY_TABLE_INDEX+1}}
    </script>
    <script type="text/javascript" src="layuiadmin/layui/layui.all.js"></script>
    <link href="layuiadmin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <!-- <link rel="stylesheet" href="${pageContext.request.contextPath}/css/layui/css/layui.css" rel="external nofollow" >
    <script src="${pageContext.request.contextPath}/js/layui.js" ></script> -->
</head>
<body>
<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item">
        <div class="layui-card-header">

            <div class="layui-input-inline">
                <input type="text" name="title1" lay-verify="title"
                       autocomplete="off" placeholder="请输入单号" class="layui-input">
            </div>
            <div class="layui-input-inline">

                <input type="text" name="title" lay-verify="title"
                       autocomplete="off" placeholder="请输入时间区间" class="layui-input">
            </div>
            <div class="layui-input-inline">
                    <select name="interest" lay-filter="aihao">
                        <option value="">请选择状态</option>
                        <option value="0">临时保存</option>
                        <option value="1">审批中</option>
                        <option value="2">报价中</option>
                        <option value="3">提货中</option>
                        <option value="4">跟单报价</option>
                    </select>
            </div>
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-lg" data-type="reload"
                        onclick="SearchTime()" id="LAY-component-form-getval">搜索
                </button>
            </div>
        </div>
    </div>

    <div class="layui-tab-item layui-show">
        <table class="layui-hide" id="table-WZD" lay-filter="table-WZD"></table>

        <div class="layui-card-header">
								<span class="layui-layout-right" style="margin-right: 20px; margin-top: -10px;">
									<button class="layui-btn layui-btn-danger layui-btn-sm" id="Ts">删除记录</button>
									<button class="layui-btn layui-btn-danger layui-btn-sm" id="TT">确认发布</button>
                                    <!--<a class="layui-btn layui-btn-danger layui-btn-sm" id="T" href="javascript:getSUP();">确认发布</a>-->
								</span>
        </div>


    </div>
</form>

<script src="layuiadmin/layui/layui.js"></script>
<script typetype="text/javascript"></script>
<!-- 新增 -->
<script>
    layui.config({
        base: 'layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'upload', 'form'], function () {
        var table = layui.table;
        table.render({
            elem: '#table-WZD'
            , url: 'http://localhost:8086/selectPingZheng'
            , limits: [3]
            , limit: 3 //每页默认显示的数量
            , page: true
            , cols:
                [
                    [
                        {type: 'checkbox'}
                        , {type: 'number', title: '序号', templet: '#xuhao', width: 60, align: 'center'}
                        , {field: 'vENDORCODE', title: '商户', width: 120, align: 'center'}
                        , {field: 'vENDORNAME', title: '编码', align: 'center'}
                        , {field: 'rEGISTEREDAREA', title: 'ID', width: 150, align: 'center'}
                        , {field: 'pHONE', title: 'ID', width: 150, align: 'center'}
                        , {field: 'aDDRESS', title: '名字', width: 150, align: 'center'}
                        , {field: 'dDLD', title: '电话', width: 150, align: 'center'}
                        , {field: 'eNABLEDFLAG', title: '地区', width: 150, align: 'center'}
                    ]
                ]
        });

		//表单取值
		layui.$('#LAY-component-form-getval').on('click', function () {
			var data = form.val('example');
			var ts = JSON.stringify(data);
			alert(ts);
	/*		$.ajax({
				url: 'http://localhost:8086/insertks',
				type: 'post',
				data: ts,
				dataType: 'json',
				contentType: 'application/json; charset=utf-8',
				success: function (ts) {
					alert(ts.msg);
					location.reload();

				}
			});*/
		});
        //监听行单击事件（双击事件为：rowDouble）
        table.on('rowDouble(table-WZD)', function (obj) {
            var data = obj.data;
			layer.open({
				type: 2,
				title: "+修改信息",
				area: ['600px', '480px'],
				skin: 'layui-layer-rim',
				content: ['http://localhost:8086/page?url=new/updateOrder.html', 'no']
			});

            layer.alert(JSON.stringify(data), {
                title: '当前行数据：'
            });
            //事件监听获取选中的复选框的值
            table.on('checkbox(table-WZD)', function () {
                var checkStatus = table.checkStatus('table-WZD');
                console.log("选中的值1!!");
                console.log(checkStatus.data)//选中行数据
                alert(JSON.stringify(checkStatus.data));
            })
            $("#Ts").click(function () {
                var index = parent.layer.getFrameIndex(window.name);
                var checkStatus = table.checkStatus('table-WZD');//获取选中的值
                console.log("选中的值");
                // console.log(checkStatus.data);
                var paramJson3 = JSON.stringify(checkStatus.data)
                console.log(paramJson3);
                $.ajax({
                    url: 'http://localhost:8086/deletebuyer',
                    type: 'post',
                    data: paramJson3,
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function (paramJson3) {
                        alert(paramJson3.msg);
                        table.reload('table-WZD', {
                            url: 'http://localhost:8086/new/selectPingZheng'
                        })

                    }
                });
            });

            $("#TT").click(function () {
                var index = parent.layer.getFrameIndex(window.name);
                var checkStatus = table.checkStatus('table-WZD');//获取选中的值
                console.log("选中的值");
                alert("推送信息内容");
                // console.log(checkStatus.data);
                var paramJson3 = JSON.stringify(checkStatus.data)
                console.log(paramJson3);
                $.ajax({
                    url: 'http://localhost:8086/deletebuyer',
                    type: 'post',
                    data: paramJson3,
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function (paramJson3) {
                        alert(paramJson3.msg);
                        table.reload('table-WZD', {
                            url: 'http://localhost:8086/new/selectPz'
                        })
                    }
                });
            });
        });
    });
</script>
</body>
</html>